#pragma once
#include "base/function.h"
#include "util/noncopyable.h"
#include "base/config.h"
#include "net/socket.h"

namespace net_tools
{
  class Eventloop;
  namespace base
  {
    class Channel;
  } // namespace base
  namespace net
  {

    class Accept : net_tools::util::noncopyable
    {
    public:
      Accept(func new_accept, net_tools::Eventloop *eventloop); //need in right thread
      ~Accept();
      void Init_listen(int port = _C::DEFAULT_PORT);
      void Stop_listen();
      inline int Get_accept_fd() const { return listen_fd_; };

    private:
      Socket socket_;
      int listen_fd_;
      net_tools::Eventloop *eventloop_;
      net_tools::base::Channel *channel_;
    };

  } // namespace net
} // namespace net_tools